#!/usr/bin/env python
"""
PyLink-SR (Python Linked Software Radio System)
(c) Bob Cowdery (G3UKB) 2008

File: defs.py
Date: August 2008

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

The author can be reached by email at

bob@g3ukb.co.uk

========================================================================
Module Description:
Common definitions across processes

"""

#-----------------------------------------------------------------------
# System imports
import logging
import sys
import config_service as config

#-----------------------------------------------------------------------
# Offsets into the shared memory inter-process comms area
# RADIO STATE
DSP_CONTROL = 0                                    # values  'U' = Undefined, 'G' = Go, 'S' = Stop, 'C' = Close, 
DSP_MODE = DSP_CONTROL+1                           # LSB = '0', USB = '1', CW_L = '2', CW_U = '3', AM = '4'
DSP_FILT = DSP_MODE+1                              # 6KHz = '0', 2.4kHz = '1', 2.1kHz = '2', 1.0kHz = '3', 500Hz = '4', 250Hz = '5', 100Hz = '6'
DSP_AGC = DSP_FILT+1                               # (ON = '1', OFF = '0')(Slow = 'S', FAST = 'F', VFAST = 'V')
DSP_RATE = DSP_AGC + 1
DSP_FREQ_MHZ = (DSP_RATE+1,DSP_RATE+4)             # Frequency as 3x3 digits
DSP_FREQ_KHZ = (DSP_RATE+4,DSP_RATE+7)
DSP_FREQ_HZ = (DSP_RATE+7,DSP_RATE+10)

#-----------------------------------------------------------------------
# Constants for RADIO STATE
# DSP_CONTROL allowed values
DSP_UNDEF = 'U'
DSP_START = 'G'
DSP_STOP = 'S'
DSP_CLOSE = 'C'

# DSP_MODE allowed values
M_LSB = '0'
M_USB = '1'
M_CWL = '2'
M_CWU = '3'
M_AM = '4'
M_NFM = '5'

# DSP_FILTER allowed values
F_6K = '0'
F_2K4 = '1'
F_2K1 = '2'
F_1K = '3'
F_500 = '4'
F_250 = '5'
F_100 = '6'

# AGC allowed values
AGC_ON = '1'
AGC_OFF = '0'
AGC_SLOW = 'S'
AGC_MED = 'M'
AGC_FAST = 'F'